package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.Orders;
import com.sky.vo.OrderVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface AdminOrderMapper {
    Page<Orders> conditionSearch(OrdersPageQueryDTO ordersPageQueryDTO);

    @Select("select COUNT(*) from orders where status = #{completed} ")
    Integer getConfirmedNumber(Integer completed);

    @Select("select COUNT(*) from orders where status = #{toBeConfirmed} ")
    Integer getToBeConfirmedNumber(Integer toBeConfirmed);

    @Select("select COUNT(*) from orders where status = #{deliveryInProgress} ")
    Integer getDeliveryInProgressNumber(Integer deliveryInProgress);

    @Select("select * from orders where status = #{pendingPayment} and order_time < #{dateTime}")
    List<Orders> SelectOrderTimeout(Integer pendingPayment, LocalDateTime dateTime);

    Integer countByMap(Map map);
}
